﻿using BehaviorDesigner.Runtime.Tasks;
using BepInEx;
using BepInEx.Configuration;
using GUIPackage;
using HarmonyLib;
using JSONClass;
using KBEngine;
using Mod;
using Steamworks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace ncs.lingtian
{
    [BepInPlugin("ncs.lingtian", "灵田增强", "1.0.8")]
    public partial class LingTianMod : BaseUnityPlugin
    {
        protected static LingTianMod MainMod;

        public ConfigEntry<int> lingtiansudu;
        public ConfigEntry<int> julingsudu;

        public ConfigEntry<int> pingzicuishengsudu;
        public ConfigEntry<int> pingzi;

        public ConfigEntry<int> lingyanxiuliansudu;
        public ConfigEntry<int> julingzhenxiuliansudu;

        // 感悟
        public ConfigEntry<int> ganWuTime;
        public ConfigEntry<int> lingWuOrTuPoTime;
        public ConfigEntry<int> lingGan;

        public ConfigEntry<int> lianqiCostTime;

        public ConfigEntry<int> menPaiHaoGan;

        public int lingshi; 

        void Start()
        {
            MainMod = this;
            this.lingtiansudu = base.Config.Bind<int>("灵田", "灵气倍率", 10, "洞府灵眼对灵田催熟的加成");
            this.julingsudu = base.Config.Bind<int>("灵田", "聚灵倍率", 10, "聚灵阵对灵田催熟的加成");
            this.pingzicuishengsudu = base.Config.Bind<int>("瓶子", "灵气倍率", 10, "瓶子对灵田催熟的加成");
            this.pingzi = base.Config.Bind<int>("瓶子", "灵石倍率", 1000, "瓶子催熟消耗的灵石的倍率（除以）");
            this.lingyanxiuliansudu = base.Config.Bind<int>("修炼", "灵眼倍率", 10, "灵眼对修炼的加成");
            this.julingzhenxiuliansudu = base.Config.Bind<int>("修炼", "聚灵倍率", 10, "聚灵阵对修炼的加成");

            this.ganWuTime = base.Config.Bind<int>("感悟", "时间", 10, "感悟的速度");
            this.lingWuOrTuPoTime = base.Config.Bind<int>("领悟突破", "时间", 10, "悟性对领悟和突破的影响");
            this.lingGan = base.Config.Bind<int>("灵感", "灵感", 10, "灵感恢复的速度"); 

            this.lianqiCostTime = base.Config.Bind<int>("炼器", "练气", 1, "炼器的速度");

            this.menPaiHaoGan = base.Config.Bind<int>("声望", "声望", 1, "门派声望获取的速度");

            Harmony.CreateAndPatchAll(typeof(LingTianMod)); 
        }

        void Update()
        {  
            // 添加F10快捷键打开配置面板
            if (Input.GetKeyDown(KeyCode.Insert))
            { 
                if(PlayerEx.Player != null) isPanelVisible = !isPanelVisible;
                //PlayerEx.AddNingZhouShengWang(100);
            }
        } 

        #region 日志
        public static void Error(object data)
        {
            MainMod.Logger.LogError(data);
        }

        public static void Info(object data)
        {
            MainMod.Logger.LogInfo(data);
        }
        #endregion

       
    }
}


